window.onload = function () {
    // 获取切换部分的元素
    var item = document.getElementsByClassName("item");
    var it = item[0].getElementsByTagName("div");

    // 获取用户信息收集部分的元素
    var content = document.getElementsByClassName("content");
    var con = content[0].getElementsByTagName("div");

    // 获取文本框部分的元素
    var subs = document.getElementsByClassName('substance');
    var fsubs = document.getElementsByClassName('firstsubstance');
    var firstmessage = document.querySelector('.firstmessage');
    var message = document.querySelector('.message');


    // 点击切换事件
    for (let i = 0; i < it.length; i++) {
        it[i].addEventListener('click', function () {
            for (let j = 0; j < it.length; j++) {
                it[j].className = '';
                con[j].style.display = "none";
            }
            this.className = "active";
            it[i].index = i;
            con[this.index].style.display = "block";
        })
    }
}

//判断两次输入密码是否一致
function check2pwd() {
    if (input1.value != input2.value) {
        alert("两次输入密码不一致！")
        input1.value = "";
        input2.value = "";
    }
}

//提醒用户注册成功
function Successful() {
    alert("恭喜你注册成功！");
}

//登录判断
function Enroll() {
    if (username.value == "" || password.value == "") {
        alert("请重新检查信息");
        return false;
    }
    else {
        window.location.href = 'test.html';
    }
}
